package com.qwz.example;

import com.qwz.common.TempDb;
import com.qwz.example.component.Component;

import java.util.Date;
/**
* @Description: 装饰器对象，计算当月业务奖金
* @Package com.qwz.example.MonthPrizeDecorator
* @author Qiuwuzhi
* @date 2019/12/19 13:39
* @version V1.0
*/
public class MonthPrizeDecorator extends Decorator {
    @Override
    public double calcPrize(String user, Date begin, Date end) {
        //计算出前面运算出来的奖金
        double money = super.calcPrize(user, begin, end);
        //计算出当月业务奖金，按人员和时间获取当月业务额，再乘以0.03
        double prize = TempDb.mapMonthSaleMoney.get(user) * 0.03;
        System.out.println(user+"-当月业务奖金-"+prize);
        return money + prize;
    }

    /**
     * 通过构造方法传入被装饰的对象
     *
     * @param component
     */
    public MonthPrizeDecorator(Component component) {
        super(component);
    }


}
